home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2602 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  46 lines

  1. Path: nic.wat.hookup.net!news
  2. From: xenon@the-fix.sos.on.ca
  3. Newsgroups: comp.lang.c
  4. Subject: Streams
  5. Date: Mon, 22 Jan 1996 18:27:41 GMT
  6. Organization: HookUp Communication Corporation, Waterloo, Ontario, CANADA
  7. Message-ID: <4e0lp3$lkf@nic.wat.hookup.net>
  8. NNTP-Posting-Host: slip10.sos.on.ca
  9. X-Newsreader: Forte Free Agent 1.0.82
  10.  
  11. HI,  im having some trouble getting my program to write to streams...
  12. ex:
  13.  
  14.  
  15. #include <stdio.h>
  16.  
  17. int main(void)
  18. {
  19.    FILE *stream;
  20.    int i = 100;
  21.    char c = 'C';
  22.    float f = 1.234;
  23.  
  24.    /* open a file for update */
  25.    stream = fopen("DUMMY.FIL", "w+");
  26.  
  27.    /* write some data to the file */
  28.    fprintf(stream, "%d %c %f", i, c, f);
  29.  
  30.    /* close the file */
  31.    fclose(stream);
  32.    return 0;
  33. }
  34.  
  35.  
  36.     This example taken out of the Borland Help library should work fine.
  37. Yet, nothing is written to the file "dummy.fil".  although the file is
  38. created.  I have tried running my comiler from Dos and Win95 to no
  39. avail.  My stream problem is no just centered around the disk file
  40. streams, but also stdout, and stderr.  Strangely though, my read() and
  41. write() functions work just fine.
  42. thankx
  43. xenon@the-fix.sos.on.ca
  44.  
  45.  
  46.